package com.cxs;

import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.core.env.Environment;

import java.net.InetAddress;
import java.net.UnknownHostException;
/**
 * @ClassName: SeatSubscribeApplication
 * @description:   启动类Application
 * @author: 诗涵
 * @create: 2024-01-07 08:17
 */
@SpringBootApplication
@MapperScan(basePackages = "com.cxs.mapper")
@Slf4j
public class SeatSubApplication {

    public static void main(String[] args) throws UnknownHostException {
        ConfigurableApplicationContext application = SpringApplication.run(SeatSubApplication.class, args);
        Environment env = application.getEnvironment();
        String ip = InetAddress.getLocalHost().getHostAddress();
        String port = env.getProperty("server.port");
        String path = env.getProperty("server.servlet.context-path");

        log.info("\n----------------------------------------------------------\n\t" +
                "程序启动成功! URLs:\n\t" +
                "首页: \t\thttp://" + ip + ":" + port + "\n\t" +
                "----------------------------------------------------------");
    }

    @Bean
    public PaginationInterceptor paginationInterceptor(){
        return new PaginationInterceptor();
    }
}
